<?php
/**
 * RUBIK IT Solution & Development Co.ltd,
 *
 * PROJECT		: Auction
 * COPYRIGHT	: 2010
 * ------------------------------------------------------
 * 
 * DTO class of  #__member table
 *
 * @author			generator <hoadn@rubik.com.vn>
 * @access			public
 * @package			dbo.AuctionExportViewDTO
 *
 * Created on	: September 13, 2010
 */

// Importer
RCoreImporter::cls( "dbo.AbstractDTO" );

/**
 * @name AuctionExportViewDTO
 * The data transfer object class for table: #__user
 */
class AuctionExportViewDTO extends AbstractDTO {
	
	// Keys
	var $user_id	= "N*||u|key";
	var $business_name	= "S||u|";
	var $start_date	= "DT||a|";
	var $time_zone	= "S||a|";
	var $item_num	= "S||v|vehicle_id";
	var $lot_num	= "S||v|";
	var $vehicle_type	= "S||c|name";
	var $year	= "S||v|";
	var $marker	= "S||m|name";
	var $model_group	= "S||mo|";
	var $model_detail	= "S||mo|";
	var $body_style	= "S||v|";
	var $color	= "S||v|";
	var $damage_desc	= "S||d|description";
	var $secondary_damage	= "S||d1|description";
	var $sale_title_state	= "S||s|name";
	var $sale_title_type	= "S||sa|saletitletype";
	var $haskey	= "S||v|";
	var $vin	= "S||v|";
	var $odometer	= "S||v|";
	var $odometer_brand	= "S||v|";
	var $lot_acv	= "S||v|";
	var $repair_cost	= "S||v|";
	var $engine	= "S||v|";
	var $drive	= "S||dr|drive";
	var $transmission	= "S||v|";
	var $fuel	= "S||f|fuel";
	var $cylinder	= "S||v|";
	var $runs_drives	= "S||v|";
	var $sale_status	= "S||a|status";
	var $high_bid	= "S||a|current_bid";
	var $special_note	= "S||v|";
	var $city_name	= "S||c|name";
	var $state_name	= "S||s|name";
	var $zip_code	= "S||a|zip";
	var $country_name	= "S||co|name";
	var $currentcy_code	= "S|||('USD')";
	var $images	= "S|||GROUP_CONCAT(g.file_name)";	
	var $video	= "S||v|video";
	var $create_date	= "S||a|";
	var $end_date	= "S||a|";
	var $bid_amount	= "S||a|current_bid";
	
	/**	
	 * Constructor	
	 *	
	 * @param string $where	 the where string (without WHERE)
	 * @param string $orderBy the other by string (with order by)
	 * @param DataBase $db the database (if null the database of system will be specify)
	 */	
	function __construct($where='', $orderBy = '', $db = null) {	
		$orderBy = " GROUP BY v.vehicle_id {$orderBy}";
		parent::__construct('FROM auctions a 
					LEFT JOIN state s ON a.state_id = s.state_id
					LEFT JOIN city ci ON ci.city_id = a.city_id
					LEFT JOIN country co ON co.id = a.country_id
					JOIN vehicle v ON a.vehicle_id = v.vehicle_id
					JOIN category c ON c.category_id = v.cate_id
					LEFT JOIN saletitletype sa ON sa.saletitletype_id = v.sale_title_type_id
					LEFT JOIN fuel f ON f.fuel_id = v.fuel_id
					LEFT JOIN drive dr ON dr.drive_id = v.drive_id
					LEFT JOIN damage d ON d.damage_id = v.damage_id
					LEFT JOIN damage d1 ON d1.damage_id = v.secondary_damage_id
					LEFT JOIN maker m ON m.maker_id = v.maker_id
					LEFT JOIN model mo ON mo.model_id = v.model_id
					LEFT JOIN vehicle_images vi ON vi.vehicle_id = v.vehicle_id
					LEFT JOIN photos_gallery g ON g.image_id = vi.image_id
					JOIN `user` u ON u.user_id = v.owner_id 
							', $where, $orderBy, $db);
	}	
}
?>